package com.cn.kabalifeuser.utils;

/**
 * Created by 晓林 on 2019/11/8.
 * function:
 */
public class WebViewHtmlUtils {

    /**
     * 富文本适配
     */
    public static String getHtmlData(String bodyHTML) {
        String head = "<head>"
                + "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, user-scalable=no\"> "
                + "<style>img{max-width: 100%; width:auto; height:auto;}</style>"
                + "<style>table{max-width: 100%; width:auto; height:auto;}</style>"
                + "</head>";
        return "<html>" + head + "<body>" + bodyHTML + "</body></html>";
    }


    public static String getHtmlData1(String bodyHTML) {
//        windowWidth = windowWidth/2;
        String css = "<style> img{max-width:100%;width:auto !important;height:auto !important;min-height:10px;} p{margin-top:0 !important;margin-bottom:0 !important;}</style>";
        String html = "<html><header>" + css + "</header><body style='margin:0;padding:0'>" + bodyHTML + "</body></html>";
        return html;
    }
}
